﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'rightToRoleAdd')
	BEGIN
		DROP  Procedure  rightToRoleAdd
	END
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[rightToRoleAdd] 
	-- Add the parameters for the stored procedure here
	@right_id INT, 
	@role_id INT
AS
BEGIN
	SET NOCOUNT ON;

	-- Insert statements for procedure here
	IF (NOT EXISTS(	SELECT * 
					FROM lit_rol_privilegio
					WHERE lit_rol_id = @role_id
					AND lit_privilegio_id = @right_id)) 
	BEGIN
		INSERT into lit_rol_privilegio (lit_rol_id, lit_privilegio_id)
		VALUES (@role_id, @right_id);
	END
END

GO